﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ShowProduct : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int Id = 0;

        if (Request.QueryString["id"] != null)          //Er der noget i QueryString ?
        {
            if (int.TryParse(Request.QueryString["id"], out Id))
            {
                //cinemabookingdbDataContext db = new cinemabookingdbDataContext();
                ServiceReferenceMovieInfo.MovieInfoServiceClient MovieInfoService = new ServiceReferenceMovieInfo.MovieInfoServiceClient();
                ServiceReferenceMovieInfo.MovieInfo MovService = new ServiceReferenceMovieInfo.MovieInfo();

                //MovieInfo m = db.MovieInfos.SingleOrDefault(x => x.id == Id);
                MovieInfoService.GetMovieById(Id);

                if (MovieInfoService.GetMovieById(Id) != null)
                {
                    movieName.InnerHtml = MovService.name;
                    movieGenre.InnerHtml = "Genre: " + MovService.genre;
                    movieDescription.InnerHtml = "Beskrivelse: " + MovService.description;
                    imgMovie.Src = MovService.picture;

                    myModalLabel.InnerHtml = MovService.name;

                    videoTrailer.Attributes["src"] = MovService.trailer;

                }
            }
        }
    }

}